﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MetroHome
{
    /// <summary>
    /// Interaction logic for LibraryItem.xaml
    /// </summary>
    public partial class LibraryItem : UserControl
    {
        public LibraryItem()
        {
            InitializeComponent();
        }

        public string Title
        {
            get { return TitleTextBlock.Text; }
            set { TitleTextBlock.Text = value; }
        }

        public ImageSource Icon
        {
            get { return IconImage.Source; }
            set { IconImage.Source = value; }
        }

        private int _order = 0;
        public int Order
        {
            get { return _order; }
            set
            {
                _order = value;
                //TransformAnim.BeginTime = TimeSpan.FromMilliseconds(50 * value);
            }
        }


        private void UserControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
           Scale.ScaleX = 0.9;
           Scale.ScaleY = 0.9;
        }

        private void UserControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Scale.ScaleX = 1;
            Scale.ScaleY = 1;
        }

        private void UserControl_MouseLeave(object sender, MouseEventArgs e)
        {
            Scale.ScaleX = 1;
            Scale.ScaleY = 1;
        }

        private void TransformAnim_CurrentStateInvalidated(object sender, EventArgs e)
        {
            if ((Clock)sender != null && ((Clock)sender).CurrentState == ClockState.Active)
                this.Opacity = 1;
        }
    }
}
